from django.db import models

from grades.models import Grade

# Create your models here.
class Score(models.Model):
    title = models.CharField(max_length=20,  verbose_name='考试名称')
    student_number = models.CharField(max_length=20, verbose_name='学号')
    student_name = models.CharField(max_length=20, verbose_name='姓名')
    chinese_score = models.DecimalField(max_digits=5, decimal_places=2, help_text='|__语文成绩')
    math_score = models.DecimalField(max_digits=5, decimal_places=2, help_text='|__数学成绩')
    english_score = models.DecimalField(max_digits=5, decimal_places=2, help_text='|__英语成绩')

    grade = models.ForeignKey(Grade, on_delete=models.CASCADE, related_name='score')

    def __str__(self):
        return self.title
    
    class Meta:
        db_table = 'score'
        verbose_name = '成绩管理'
        verbose_name_plural = '成绩信息'